<template>
    <!-- 导航栏 -->
    <van-nav-bar title="消费记录" left-text="返回" left-arrow @click-left="back" />

    <van-cell-group v-for="item in list" :key="item.id">
        <van-cell center :title="item.content" :value="item.createtime" />
    </van-cell-group>

</template>
<script>
export default {
    emits: ['toggle'],
    created() {
        this.$emit('toggle', false)

        this.recordList()
    },
    data() {
        return {
            LoginUser: this.$cookies.get('LoginUser'),
            list: []
        }
    },
    methods: {
        // 返回上一级
        back() {
            this.$router.push({
                path: '/user/base/index'
            })
        },
        async recordList() {
            let data = {
                userid: this.LoginUser.id,
                status: 'vue'
            }
            let result = await this.$api.record(data)
            if (result.code == '1') {
                this.list = result.data
            } else {
                //提醒信息
                this.$notify({
                    message: result.msg,
                    duration: 1000,
                })
            }
        }
    }
}
</script>